package com.wabbei.friendcenter.action;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Date;

import org.apache.struts2.ServletActionContext;

import com.webbei.friendcenter.service.MyFriendCenter;

public class SendReportByAjAxAction {
	private MyFriendCenter friservice;
	private String beReportName;// bereportName
	private String reprotContent;
	private Date reportTime;
	private String reportName; 
	private int commentId;
	private InputStream inputstream;
	
	public InputStream getInputstream() {
		//ServletActionContext.getResponse().getWriter().write("");
		String result="true";
		reportTime=new Date();
		//reportName=ActionContext.getContext().getSession().get("");
		reportName=(String)ServletActionContext.getContext().getSession().get("username");
		System.out.println(reprotContent+":report");
		int j=friservice.insertNewReport(reportName,beReportName,reprotContent,reportTime,commentId);
		if(j==1){
			result="true";	
		}else{
			result="false";	
		}
		inputstream=new ByteArrayInputStream(result.getBytes());
		return inputstream;
	}
	public void setInputstream(InputStream inputstream) {
		this.inputstream = inputstream;
	}
	public MyFriendCenter getFriservice() {
		return friservice;
	}
	public void setFriservice(MyFriendCenter friservice) {
		this.friservice = friservice;
	}
	public String getBeReportName() {
		return beReportName;
	}
	public void setBeReportName(String beReportName) {
		this.beReportName = beReportName;
	}
	public String getReprotContent() {
		return reprotContent;
	}
	public void setReprotContent(String reprotContent) {
		this.reprotContent = reprotContent;
	}
	public Date getReportTime() {
		return reportTime;
	}
	public void setReportTime(Date reportTime) {
		this.reportTime = reportTime;
	}
	public String getReportName() {
		return reportName;
	}
	public void setReportName(String reportName) {
		this.reportName = reportName;
	}
	public int getCommentId() {
		return commentId;
	}
	public void setCommentId(int commentId) {
		this.commentId = commentId;
	}
	public String check(){
		System.out.println("sasa");
		return "success";
	}
}
